package com.itheima.mapper;

import com.itheima.entity.Student;
import com.itheima.entity.StudentQueryParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author 马祥和
 * @version 1.0
 * @function
 * @time 2025/7/31 16:28
 */
@Mapper
public interface StudentMapper {

    List<Student> page(StudentQueryParam sqp);

    void delete(List<Integer> ids);

    void insert(Student student);

    Student getById(Integer id);

    void update(Student student);

    @Update("update student set violation_count = violation_count + 1, violation_score = violation_score + #{score}, update_time = now() where id=#{id}")
    void updateScore(Integer id, Integer score);
}
